
{% extends "layouts/base.html" %}

{% block title %} UI Tables {% endblock %} 

<!-- Specific CSS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}

{% block content %}

<div class="pcoded-content">
    <div class="pcoded-inner-content">
        <!-- [ breadcrumb ] start -->
        <div class="page-header">
            <div class="page-block">
                <div class="row align-items-center">
                    <div class="col-md-12">
                        <div class="page-header-title">
                            <h5 class="m-b-10">Bootstrap Basic Tables</h5>
                        </div>
                        <ul class="breadcrumb">
                            <li class="breadcrumb-item"><a href="/"><i class="feather icon-home"></i></a></li>
                            <li class="breadcrumb-item"><a href="/tables">Tables</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <!-- [ breadcrumb ] end -->
        <div class="main-body">
            <div class="col-sm-12">
                
                <div class="tab-content" id="myTabContent">
                    <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                        <p class="mb-0">

                            <div class="col-md-6">
                                &nbsp
                                {% if success %}
                                    <i class="fas fa-circle text-c-green f-10 m-r-15"></i>
                                {% else %}
                                    <i class="fas fa-circle text-c-red f-10 m-r-15"></i>
                                {% endif %}
                                <span class="mb-0 text-muted">
                                    {% if msg %}
                                        {{ msg | safe }}
                                    {% else %}
                                        Let's rent a bag!
                                    {% endif %} 
                                </span>
                            </div>
                            
                            <br/>

                            
                            <table class="table table-hover">
                                <thead>
                                    <th> bid </th>
                                    <th> btype </th>
                                    <th> color </th>
                                    <th> Designer's name </th>
                                    <th> 租几天？ </th>
                                    <th> 买保险吗 ？</th>
                                    <th> Operation </th>
                                </thead>
                                <tbody>
                                {% for obj in objs %}
                                <form role="form" method="post" action="">
                                    {% csrf_token %} 
                                    <input type="hidden" name="bag_id" value={{obj.bid}}>

                                    {% if obj.already_rented == 0 %}
                                    <tr>
                                        <td>{{ obj.bid }}</td>
                                        <td>{{ obj.btype }}</td>
                                        <td>{{ obj.color }}</td>
                                        <td>{{ obj.did.name }}</td>

                                        <td width= "20%">
                                            <input type="number" min="1" max="3650" placeholder="租借天数" name="days" class="form-control">
                                        </td>

                                        <td width= "20%">
                                            <select class="form-control" id="exampleFormControlSelect1" name="insurance">
                                                <option value ="0">不买</option>
                                                <option value ="1">买</option>
                                            </select>
                                        </td>
                                        <td>
                                            <button type="submit" class="btn btn-primary">租这个</a>
                                        </td>
                                        
                                    </tr>
                                    {% endif %}
                                </form>
                                {% endfor %}
                                </tbody>
                            </table>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}{% endblock javascripts %}
